<?php
	include "../../inc/log/adsession.php";
	// include "../../inc/data/connAdmin.php";
?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<?php
	//1903010328获取信息
	include "../../inc/data/connAdmin.php";
	$depNewN = $_POST["depNew"];
	$depOld = $_POST["depOld"];
	//1903010328删除
	$sql = "select * from mamx_dep where depname = ?";
	$stmt=$conn->prepare($sql);
	$stmt->bind_param("s",$depNewN);
	$stmt->execute();
	if ($stmt->fetch()) {
			echo <<<END
			<script type="text/javascript">
			alert("学院名称已存在，请重新输入！");
			history.back();
			</script>
END;
		}else{
			// 修改名字
			$sql1 = "update mamx_dep set depname=? where depname=?";
			$stmt1=$conn->prepare($sql1);
			$stmt1->bind_param("ss",$depNewN,$depOld);
			$stmt1->execute();
			if ($stmt1->affected_rows==1) {
				echo <<<END
				<script type="text/javascript">
				alert("学院名字修改成功！");
				location="depAdmin.php";
				</script>
END;
			}
		}
	?>
</body>
</html>